#pragma once
#include <odb/core.hxx>
#include <odb/nullable.hxx>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <string>

#pragma db object
class FriendApply {
public: 
    FriendApply() = default;
    FriendApply(const std::string& event_id, const std::string& user_id, const std::string& peer_id)
        : _event_id(event_id), _user_id(user_id), _peer_id(peer_id) {}

    std::string event_id() const { return _event_id; }
    std::string user_id() const { return _user_id; }
    std::string peer_id() const { return _peer_id; }

    void set_event_id(const std::string& event_id) { _event_id = event_id; }
    void set_user_id(const std::string& user_id) { _user_id = user_id; }
    void set_peer_id(const std::string& peer_id) { _peer_id = peer_id; }
private:
    friend class odb::access;
    
    #pragma db id auto
    unsigned long _id; // 数据库分配的 ID

    #pragma db type("varchar(64)") unique
    std::string _event_id;

    #pragma db type("varchar(64)") index
    std::string _user_id; // 用户 ID

    #pragma db type("varchar(64)") index
    std::string _peer_id; // user_id向peer_id申请添加好友
};